package com.ccp.dev.workflow.model;

import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * ClassDescribe
 * @author: fanruiqi
 * Date: 2019-09-20
 * Since:1
 * To change this template use File | Settings | File Templates.
 */
public class AgentSetting extends BaseModel<AgentSetting> {
    /**
     * 代理类型：全权代理
     */
    public static int AUTHTYPE_GENERAL   	=0;
    /**
     * 代理类型：部分代理
     */
    public static int AUTHTYPE_PARTIAL   	=1;
    /**
     * 代理类型：条件代理
     */
    public static int AUTHTYPE_CONDITION    =2;

    /**
     * 状态：启用
     */
    public static Long ENABLED_YES 			= 1L;
    /**
     * 状态：禁用
     */
    public static Short ENABLED_NO 			= 0;

    /**
     * 主键
      */
    protected String   id;
    /**
     * 授权人ID
     */
    protected String   authId;
    /**
     * 授权人
     */ 
    protected String  authName;
    /**
     * 授权时间
     */
    protected String  createTime;
    /**
     * 开始时间
       */
    protected Date startTime;
    /**
     * 结束时间
     *  */
    protected Date  endTime;
    /**
     * 是否启用(0,禁止,1,启用)
     *  */
    protected Short  enabled=1;

    /**
     * 授权类型(0,全权,1,部分流程,2,条件代理)
     *  */
    protected Short  authType=0;
    /**
     * 代理人ID
     *  */
    protected String  agentId;
    /**
     * 代理人
     *  */
    protected String  agent;
    /**
     *  流程key(条件代理时填写)
     */
    protected String  flowKey;
    /**
     *  流程名称
     */
    protected String  flowName;

    /**
     *  部分代理  代理的流程
     */
    protected List<AgentDefModel> agentDefList = new ArrayList<AgentDefModel>();

    /**
     *  条件代理  条件
     */
    protected List<AgentCondition> agentConditionList = new ArrayList<AgentCondition>();

    public void setId(String id)
    {
        this.id = id;
    }
    /**
     * 返回 主键
     */
    public String getId()
    {
        return this.id;
    }
    public void setAuthId(String authId)
    {
        this.authId = authId;
    }
    /**
     * 返回 授权人ID
     */
    public String getAuthId()
    {
        return this.authId;
    }
    public void setAuthName(String authName)
    {
        this.authName = authName;
    }
    /**
     * 返回 授权人
     */
    public String getAuthName()
    {
        return this.authName;
    }

    public void setStartTime(Date startTime)
    {
        this.startTime = startTime;
    }
    /**
     * 返回 开始时间
     */
    public Date getStartTime()
    {
        return this.startTime;
    }
    public void setEndTime(Date endTime)
    {
        this.endTime = endTime;
    }
    /**
     * 返回 结束时间
     */
    public Date getEndTime()
    {
        return this.endTime;
    }
    public void setEnabled(Short enabled)
    {
        this.enabled = enabled;
    }
    /**
     * 返回 是否启用(0,禁止,1,启用)
     */
    public Short getEnabled()
    {
        return this.enabled;
    }
    public void setAuthType(Short authType)
    {
        this.authType = authType;
    }
    /**
     * 返回 授权类型(0,全权,1,部分流程,2,条件代理)
     */
    public Short getAuthType()
    {
        return this.authType;
    }
    public void setAgentId(String agentId)
    {
        this.agentId = agentId;
    }
    /**
     * 返回 代理人ID
     */
    public String getAgentId()
    {
        return this.agentId;
    }
    public void setAgent(String agent)
    {
        this.agent = agent;
    }
    /**
     * 返回 代理人
     */
    public String getAgent()
    {
        return this.agent;
    }
    public void setFlowKey(String flowKey)
    {
        this.flowKey = flowKey;
    }
    /**
     * 返回 流程key(条件代理时填写)
     */
    public String getFlowKey()
    {
        return this.flowKey;
    }
    public void setFlowName(String flowName)
    {
        this.flowName = flowName;
    }
    /**
     * 返回 流程名称
     */
    public String getFlowName()
    {
        return this.flowName;
    }

    public List<AgentDefModel> getAgentDefList() {
        return agentDefList;
    }

    public void setAgentDefList(List<AgentDefModel> agentDefList) {
        this.agentDefList = agentDefList;
    }

    public void setAgentConditionList(List<AgentCondition> agentConditionList)
    {
        this.agentConditionList = agentConditionList;
    }
    /**
     * 返回 条件代理的配置列表
     */
    public List<AgentCondition> getAgentConditionList()
    {
        return this.agentConditionList;
    }
    /**
     * @see Object#equals(Object)
     */
    @Override
    public boolean equals(Object object)
    {
        if (!(object instanceof AgentSetting))
        {
            return false;
        }
        AgentSetting rhs = (AgentSetting) object;
        return new EqualsBuilder()
                .append(this.id, rhs.id)
                .append(this.authId, rhs.authId)
                .append(this.authName, rhs.authName)
                .append(this.createTime, rhs.createTime)
                .append(this.startTime, rhs.startTime)
                .append(this.endTime, rhs.endTime)
                .append(this.enabled, rhs.enabled)
                .append(this.authType, rhs.authType)
                .append(this.agentId, rhs.agentId)
                .append(this.agent, rhs.agent)
                .append(this.flowKey, rhs.flowKey)
                .append(this.flowName, rhs.flowName)
                .isEquals();
    }

    /**
     * @see Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.id)
                .append(this.authId)
                .append(this.authName)
                .append(this.createTime)
                .append(this.startTime)
                .append(this.endTime)
                .append(this.enabled)
                .append(this.authType)
                .append(this.agentId)
                .append(this.agent)
                .append(this.flowKey)
                .append(this.flowName)
                .toHashCode();
    }

    /**
     * @see Object#toString()
     */
    @Override
    public String toString()
    {
        return new ToStringBuilder(this)
                .append("id", this.id)
                .append("authId", this.authId)
                .append("authName", this.authName)
                .append("createTime", this.createTime)
                .append("startTime", this.startTime)
                .append("endTime", this.endTime)
                .append("enabled", this.enabled)
                .append("authType", this.authType)
                .append("agentId", this.agentId)
                .append("agent", this.agent)
                .append("flowKey", this.flowKey)
                .append("flowName", this.flowName)
                .toString();
    }

}
